package com.wms.service.impl;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.wms.bean.PageBean;
import com.wms.entity.Test;
import com.wms.mapper.TestMapper;
import com.wms.service.TestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
@Service
public class TestServiceImpl implements TestService {
    @Autowired
    TestMapper testMapper;
    @Override
    public Map get(int id) {
        return testMapper.get(id);
    }

    @Override
    public int save(Test test) {
        return testMapper.save(test);
    }

    @Override
    public PageBean queryForPage(int page, int pageSize) {
        PageHelper.startPage(page,pageSize);
        List<Test> list=testMapper.queryForList();
        PageInfo info=new PageInfo(list);
        return new PageBean(page,pageSize,info.getTotal(),list);
    }
}
